package com.miyouke.chat.entity.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PayEnums {

    /**
     * 是否已删除
     */
    public enum PAY_TYPE {

        ALIPAY("alipay", "支付宝"),

        WXPAY("wxpay", "微信"),
        ;

        public static PAY_TYPE toEnumByCode(String code) {
            PAY_TYPE[] values = values();
            for (PAY_TYPE en : values) {
                if (en.getCode().equals(code)) {
                    return en;
                }
            }
            return null;
        }

        public static List<Map<String, Object>> getValueMapList() {
            ArrayList<Map<String, Object>> list = new ArrayList<>();
            PAY_TYPE[] values = values();
            for (PAY_TYPE en : values) {
                list.add(en.getValueMap());
            }
            return list;
        }

        public Map<String, Object> getValueMap() {
            HashMap<String, Object> map = new HashMap();
            map.put("code", code);
            map.put("desc", desc);
            return map;
        }

        PAY_TYPE(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String code;

        private String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }


}
